home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
dev
/
cross
/
GBDK-2.0.lha
/
GBDK
/
lib
/
atoi.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-10-01
|
366b
|
23 lines
#include <stdlib.h>
BYTE atoi(char *s)
{
UBYTE i, sign = 0;
BYTE n;
for(i = 0; (s[i] == ' ') || (s[i] == '\n') || (s[i] == '\t'); ++i)
;
switch(s[i])
{
case '-':
sign++;
/* and fall through */
case '+':
++i;
break;
}
for(n = 0; isdigit(s[i]); ++i)
n = 10 * n + s[i] - '0';
return (sign == 0 ? n : -n);
}